;(function (window) {

var pageLogic = {
    init: {
        before: function () {
            var columns = [
                {field: "checked", checkbox: true},
                {field: "num", title: "序号", width: 5,align: "center", formatter: common.formatter.index},
                {field: "id", visible: false},
                {field: "htmc", title: "航段名称", width: 80, align: "center"},
                {field: "simpleName", title: "管理单位", width: 80, align: "center"},
                {field: "qdmc", title: "起点名称", width: 80, align: "center"},
                {field: "zdmc", title: "终点名称", width: 80, align: "center"},
                {field: "qdzh", title: "起点桩号", width: 80, align: "center"},
                {field: "zdzh", title: "终点桩号", width: 80, align: "center"},
                {field: "hdmc", title: "所属航道", width: 80, align: "center"}
            ];

            common.initTable(columns);
        },

        layout: function() {
            common.layout();
        },
        after: function () {
            //创建模态窗口
            common.modal(pageLogic.initData.modalParams[0], {
            rules: {
                htmc:{required:true,maxLen:50},
                hdpk:{required:true},
                gljgid:{required:true},
                qdzh:{required:true},
                zdzh:{required:true},
            },

            messages: {}
            });

            $("#gljgid").selectTree({
                url : masterpage.ctxp + "/sys/orgs/-1/tree"
            });

            common.dictSelect({
                id : "xzqh",
                key : "XZQH"
            });

            $("#hdpk").select({
                url : masterpage.ctxp + "/basic/hds/getAllhd",
                textField : "hdmc",
                valueField : "id",
                responseKey : "data",
                headerKey : "请选择",
                headerValue : ""
            });

            $("#hdpkSearch").select({
                url : masterpage.ctxp + "/basic/hds/getAllhd",
                textField : "hdmc",
                valueField : "id",
                responseKey : "data",
                headerKey : "请选择",
                headerValue : ""
            });
        },
        //页面控件事件绑定(一般为按钮的事件绑定)
        events: function () {
            common.registerEvents();
        },

        load: function () {
            common.search();
        }
    }
};

pageLogic.formatter = {};

window.pageLogic = pageLogic;
})(window);
